<?php

Class user_model extends CI_Model {

    public function __construct() {
        $this->load->database();
    }

    public function getUser($user = '', $pass = '') {
        if (!empty($user) && !empty($pass)) {
            $this->load->helper('url');
            $query = $this->db->get_where('user', array('username' => $user, 'password' => $pass, 'isDeleted' => 'N'));
            return $query->row_array();
        } else {
            return null;
        }
    }

    public function removeOtherLogin($username) {
        $this->db->like('user_data', $username);
        $this->db->or_where('user_data','');
        $this->db->delete('ci_sessions');
        return;
    }
    
    public function removeBlankSession() {
        $this->db->where('user_data','');
        $this->db->delete('ci_sessions');
        return;
    }

}

?>
